<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

// logic
$api = app('Dingo\Api\Routing\Router');
$api->version('v1', function ($api) {

    $api->group([
        'namespace' => 'App\Http\Controllers\api\v1',
    ], function($api) {
        // 用户
        $api->group([
            'prefix' => 'user',
        ], function($api) {
            $api->post('register', 'UserController@register');
            $api->post('login', 'UserController@login');
        });
    });
    $api->group([
        'namespace' => 'App\Http\Controllers\api\v1',
    ], function($api) {
        // 用户
        $api->group([
            'prefix' => 'user',
            'middleware' => 'auth.jwt'
        ], function($api) {
            $api->post('logout', 'UserController@logout');
            $api->post('getAuthUser', 'UserController@getAuthUser');
        });
    });
    //
    //
    $api->group([
        'namespace' => '\Rap2hpoutre\LaravelLogViewer',
    ], function($api) {
        // 用户
        $api->group([
        ], function($api) {
            $api->get('logs', 'LogViewerController@index');
        });
    });
});
